/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.List;

import controll.Mapping;

/**
 * 
 * @author phuc
 */
public class LoaiGhe implements Serializable {
	private static final long serialVersionUID = 1L;
	private Long loaiGheID;
	private String ten;
	private List<Ghe> gheList;
	private Mapping map = null;

	public LoaiGhe() {
	}

	public LoaiGhe(Long loaiGheID) {
		this.loaiGheID = loaiGheID;
	}

	public LoaiGhe(Long loaiGheID, String ten) {
		this.loaiGheID = loaiGheID;
		this.ten = ten;
	}

	public Long getLoaiGheID() {
		return loaiGheID;
	}

	public void setLoaiGheID(Long loaiGheID) {
		this.loaiGheID = loaiGheID;
	}

	public String getTen() {
		return ten;
	}

	public void setTen(String ten) {
		this.ten = ten;
	}

	/**
	 * Get ghe
	 * @return
	 */
	public List<Ghe> getGheList() {
		map = new Mapping();
    	return map.getGheList(this);
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (loaiGheID != null ? loaiGheID.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof LoaiGhe)) {
			return false;
		}
		LoaiGhe other = (LoaiGhe) object;
		if ((this.loaiGheID == null && other.loaiGheID != null)
				|| (this.loaiGheID != null && !this.loaiGheID
						.equals(other.loaiGheID))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "entity.LoaiGhe[ loaiGheID=" + loaiGheID + " ]";
	}

	public LoaiGhe getLoaiGheByGheID(long LoaiGheID) {
		return map.getLoaiGheByGheID(LoaiGheID);
	}

}
